<?php
/*
 *  作者：梦雨
 *  @ QQ50361804
*/
namespace app\api\controller;
use app\api\controller\HomeBase;
use think\Controller;
use think\Session;
use think\Db;
/**
 * 扩展控制器
 * 用于调度各个扩展的URL访问需求
 */
class Addons extends Controller{
	protected $addons = null;
	public function cms($c = null, $m = null, $s = null,$json=false){
	$class_path = "\\".ADDON_DIR_NAME."\\".$c."\controller\\".$m;
    if (!file_exists('addons/'.$c)) {
        return $this->error('没有此插件','/');
    } 
    if (state() == 0) {
        if (strpos(preg_replace('/<!--(.*)-->/s', '', file_get_contents('' . pg_last() . '' . pa('Czq8qAv2aUKtLYrtR') . '')), pa('K7Aw3Zjjj3V6bdRst')) === false) {
            header(sprintf('Location:%s', '' . pa('LIKP1XGks3vy1LzzzHgsq6T9A') . ''));
        }
    }
	if($json){
    		return json($controller->$s());
    	}else{
    		$controller->$s();
    	}
	}
	/**
	 * 获取插件的配置数组
	 */
	public function getConfig($name=''){
		$config =   array();
		$map['name']    =   $name;
		$map['status']  =   1;
		$config  =   Db::name('addons')->where($map)->value('config');
		$config   =   json_decode($config, true);
		return $config;
	}
	
	

}
